import { request } from "@/utils/http"
import {getHosListSearchParamsType,hospitalListReqReturnType, getProvinceReturnType,getHosListDetailReturnType, getHosDepartmentListReturnType, hosScheduleRuleParamsType, hosScheduleRuleReturnType, findScheduleParamsType, findScheduleListReturnType} from './model/hospitalListTypes'
//1.获取医院列表数据的请求
export const getHospitalListRequest = (page:number,limit:number, searchParams:getHosListSearchParamsType) => {
    return request.get<any,hospitalListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`,{
        params: searchParams
    })
}

//2.获取省份
export const getProvinceRequest = () => {
    return request.get<any,getProvinceReturnType>('/admin/cmn/dict/findByDictCode/province')
}
//3.获取市
export const getCityOrDistrictRequest = (parentId:string) => {
    return request.get<any,getProvinceReturnType>(`/admin/cmn/dict/findByParentId/${parentId}`)
}
//4.获取医院详情
export const getHosListDetailRequest = (id:string) => {
    return request.get<any,getHosListDetailReturnType>(`/admin/hosp/hospital/show/${id}`)
}
//5.更新状态
export const updateStatusRequest = (id:string,status: 0|1) => {
    return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}
//6.获取科室分页
export const getHosDepartmentListRequest = (hoscode:string) => {
    return request.get<any,getHosDepartmentListReturnType>(`/admin/hosp/department/${hoscode}`)
}
//7.获取排班规则数据
export const getHosScheduleListRequest = ({page,limit,hoscode,depcode}:hosScheduleRuleParamsType) => {
    return request.get<any,hosScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}
//8.获取排班日期详细列表
export const getFindScheduleListRequest = ({hoscode,depcode,workDate}:findScheduleParamsType) => {
    return request.get<any,findScheduleListReturnType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}